package com.yupi.picturebackend.config;

import com.baidu.aip.imagesearch.AipImageSearch;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 百度图片搜索配置
 */
@Configuration
@ConfigurationProperties(prefix = "baidu")
@Data
public class BaiDuImageSearchConfig {
    /**
     * appId
     */
    private String appId;

    /**
     * secretKey
     */
    private String secretKey;

    /**
     * apiKey
     */
    private String apiKey;

    /**
     * 初始化百度图片搜索
     * @return
     */
    @Bean
    public AipImageSearch baiDuImageSearch() {
        AipImageSearch client = new AipImageSearch(appId,  apiKey, secretKey);

        return client;
    }
}
